3.782 \(\int (a+a \cos (c+d x))^n (-\frac {B n}{1+n}+B \cos (c+d x)) \, dx\)

Optimal. Leaf size=28 \[ \frac {B \sin (c+d x) (a \cos (c+d x)+a)^n}{d (n+1)} \]

[Out]

B*(a+a*cos(d*x+c))^n*sin(d*x+c)/d/(1+n)

________________________________________________________________________________________

Rubi [A]  time = 0.04, antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.032, Rules used = {2749} \[ \frac {B \sin (c+d x) (a \cos (c+d x)+a)^n}{d (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(a + a*Cos[c + d*x])^n*(-((B*n)/(1 + n)) + B*Cos[c + d*x]),x]

[Out]

(B*(a + a*Cos[c + d*x])^n*Sin[c + d*x])/(d*(1 + n))

Rule 2749

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[(d*
Cos[e + f*x]*(a + b*Sin[e + f*x])^m)/(f*(m + 1)), x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &
& EqQ[a^2 - b^2, 0] && EqQ[a*d*m + b*c*(m + 1), 0]

Rubi steps

\begin {align*} \int (a+a \cos (c+d x))^n \left (-\frac {B n}{1+n}+B \cos (c+d x)\right ) \, dx &=\frac {B (a+a \cos (c+d x))^n \sin (c+d x)}{d (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.20, size = 28, normalized size = 1.00 \[ \frac {B \sin (c+d x) (a (\cos (c+d x)+1))^n}{d (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Cos[c + d*x])^n*(-((B*n)/(1 + n)) + B*Cos[c + d*x]),x]

[Out]

(B*(a*(1 + Cos[c + d*x]))^n*Sin[c + d*x])/(d*(1 + n))

________________________________________________________________________________________

fricas [A]  time = 1.44, size = 27, normalized size = 0.96 \[ \frac {{\left (a \cos \left (d x + c\right ) + a\right )}^{n} B \sin \left (d x + c\right )}{d n + d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="fricas")

[Out]

(a*cos(d*x + c) + a)^n*B*sin(d*x + c)/(d*n + d)

________________________________________________________________________________________

giac [B]  time = 55.25, size = 1370, normalized size = 48.93 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="giac")

[Out]

-2*(B*(sqrt(-tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^4 + 2*tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^2 - tan(d*x + c)^2*
tan(1/2*d*x + 1/2*c)^4 + 3*tan(d*x + c)^4 + 6*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 7*tan(d*x + c)^2 + 4*tan
(1/2*d*x + 1/2*c)^2 + 4)*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)
^2 + 1))^n*tan(-1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn
(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + pi*n*floo
r(1/4*sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)^2
- 1)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)) + 1/2) +
 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)))^2*tan(1/2*d*x + 1/2*c) - B*(sqrt(-tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^4 +
 2*tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^2 - tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^4 + 3*tan(d*x + c)^4 + 6*tan(d*
x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 7*tan(d*x + c)^2 + 4*tan(1/2*d*x + 1/2*c)^2 + 4)*abs(a)/(tan(d*x + c)^2*tan(
1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1))^n*tan(1/2*d*x + 1/2*c))/(d*n*tan(-1/4*pi*n*
sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 -
 1)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + pi*n*floor(1/4*sgn(4*a*tan(1/2*d*x
 + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/
2*c)) + 1/4*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)) + 1/2) + 1/4*pi*n*sgn(tan(1/2*d*x
 + 1/2*c)))^2*tan(1/2*d*x + 1/2*c)^2 + d*tan(-1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/
2*d*x + 1/2*c)) + 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(a)*sgn(tan
(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*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) -
1/4*sgn(tan(1/2*d*x + 1/2*c)) + 1/2) + 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)))^2 + d*tan(1/2*d*x + 1/2*c)^2 + d*n
+ d)

________________________________________________________________________________________

maple [B]  time = 0.37, size = 74, normalized size = 2.64 \[ \frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) {\mathrm e}^{n \ln \left (a +\frac {a \left (1-\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\right )}}{d \left (1+n \right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x)

[Out]

2*B/d/(1+n)*tan(1/2*d*x+1/2*c)*exp(n*ln(a+a*(1-tan(1/2*d*x+1/2*c)^2)/(1+tan(1/2*d*x+1/2*c)^2)))/(1+tan(1/2*d*x
+1/2*c)^2)

________________________________________________________________________________________

maxima [B]  time = 0.63, size = 143, normalized size = 5.11 \[ -\frac {{\left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) + 1\right )}^{n} B a^{n} \sin \left (-{\left (d x + c\right )} {\left (n + 1\right )} + 2 \, n \arctan \left (\sin \left (d x + c\right ), \cos \left (d x + c\right ) + 1\right )\right ) - {\left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) + 1\right )}^{n} B a^{n} \sin \left (-{\left (d x + c\right )} {\left (n - 1\right )} + 2 \, n \arctan \left (\sin \left (d x + c\right ), \cos \left (d x + c\right ) + 1\right )\right )}{2 \cdot 2^{n} d {\left (n + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*((cos(d*x + c)^2 + sin(d*x + c)^2 + 2*cos(d*x + c) + 1)^n*B*a^n*sin(-(d*x + c)*(n + 1) + 2*n*arctan2(sin(
d*x + c), cos(d*x + c) + 1)) - (cos(d*x + c)^2 + sin(d*x + c)^2 + 2*cos(d*x + c) + 1)^n*B*a^n*sin(-(d*x + c)*(
n - 1) + 2*n*arctan2(sin(d*x + c), cos(d*x + c) + 1)))/(2^n*d*(n + 1))

________________________________________________________________________________________

mupad [B]  time = 0.89, size = 28, normalized size = 1.00 \[ \frac {B\,\sin \left (c+d\,x\right )\,{\left (a\,\left (\cos \left (c+d\,x\right )+1\right )\right )}^n}{d\,\left (n+1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*cos(c + d*x) - (B*n)/(n + 1))*(a + a*cos(c + d*x))^n,x)

[Out]

(B*sin(c + d*x)*(a*(cos(c + d*x) + 1))^n)/(d*(n + 1))

________________________________________________________________________________________

sympy [A]  time = 4.99, size = 114, normalized size = 4.07 \[ \begin {cases} \frac {2 B \left (a - \frac {a \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{\tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 1} + \frac {a}{\tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 1}\right )^{n} \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{d n \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + d n + d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + d} & \text {for}\: d \neq 0 \\x \left (a \cos {\relax (c )} + a\right )^{n} \left (- \frac {B n}{n + 1} + B \cos {\relax (c )}\right ) & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))**n*(-B*n/(1+n)+B*cos(d*x+c)),x)

[Out]

Piecewise((2*B*(a - a*tan(c/2 + d*x/2)**2/(tan(c/2 + d*x/2)**2 + 1) + a/(tan(c/2 + d*x/2)**2 + 1))**n*tan(c/2
+ d*x/2)/(d*n*tan(c/2 + d*x/2)**2 + d*n + d*tan(c/2 + d*x/2)**2 + d), Ne(d, 0)), (x*(a*cos(c) + a)**n*(-B*n/(n
 + 1) + B*cos(c)), True))

________________________________________________________________________________________